package com.czh.subject.infra.basic.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.czh.subject.infra.basic.entity.SubjectBrief;
import com.czh.subject.infra.basic.mapper.SubjectBriefMapper;
import com.czh.subject.infra.basic.service.SubjectBriefService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 简答题(SubjectBrief)表服务实现类
 *
 * @author caozaihui
 * @since 2024-07-31 14:36:21
 */
@Service("subjectBriefService")
@RequiredArgsConstructor
public class SubjectBriefServiceImpl extends ServiceImpl<SubjectBriefMapper, SubjectBrief> implements SubjectBriefService {

        /** 
         * 
         * @param  id 主键
         * @author caozaihui  
         * @description //TODO  通过ID查询单条数据
         * @date 2024-07-31 14:36:21
         * @return 实例对象
         */
        @Override
        public SubjectBrief selectBriefBySubjectId (Long id) {
                LambdaQueryWrapper<SubjectBrief> subjectBriefLambdaQueryWrapper = new LambdaQueryWrapper<>();
                subjectBriefLambdaQueryWrapper.eq(SubjectBrief::getSubjectId,id);
                return baseMapper.selectOne(subjectBriefLambdaQueryWrapper);
        }
        
        /** 
         * 
         * @param subjectBrief 实例对象
         * @author caozaihui  
         * @description //TODO  分页查询数据
         * @date 2024-07-31 14:36:21
         * @return 实例对象
         */
        @Override
        public List<SubjectBrief> querySubjectBriefList (SubjectBrief subjectBrief) {
            return baseMapper.selectSubjectBriefList(subjectBrief);
        }
        
        /** 
         * 
         * @param subjectBrief 实例对象
         * @author caozaihui  
         * @description //TODO  新增数据
         * @date 2024-07-31 14:36:21
         * @return 实例对象
         */
        @Override
        public int insert(SubjectBrief subjectBrief) {
               return baseMapper.insert(subjectBrief);
        }
        
        
        /** 
         * 
         * @param subjectBrief 实例对象
         * @author caozaihui  
         * @description //TODO  修改数据并返回
         * @date 2024-07-31 14:36:21
         * @return 实例对象
         */
        @Override
        public int update(SubjectBrief subjectBrief) {
                return  baseMapper.updateById(subjectBrief);
        }
        
        
        /**
         *
         * @param idList 主键
         * @author caozaihui 
         * @description //TODO    通过主键删除数据
         * @date 2024-07-31 14:36:21
         * @return
         */
        @Override
        public int deleteByIds(List<Long> idList) {
            return baseMapper.deleteByIds(idList);
        }
}

